'use strict';
module.exports = (app) => {
  const { STRING, INTEGER, TEXT } = app.Sequelize;
  const BlogClassify = app.model.define('b_blogClassify', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    blogId: {
      comment: '博客ID',
      type: INTEGER,
      allowNull: false,
    },
    classifyId: {
      comment: '分类ID',
      type: INTEGER,
      allowNull: false,
    },
    classifyName: {
      comment: '分类名',
      type: STRING,
      allowNull: false,
    },
    projectId: {
      comment: '所属项目id',
      type: INTEGER,
      allowNull: false,
    },
  });
  BlogClassify.associate = function () {
    //关联
    app.model.Tables.Blog.BlogClassify.hasMany(app.model.Tables.Blog.LikeBlog, {
      foreignKey: 'blogId',
      targetKey: 'blogId',
    });
  };
  return BlogClassify;
};
